const path = require('path')

function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
  // assetsDir: 'static',
  devServer: {
    watchOptions: {
      ignore: '/node_modules/',
      poll: 1200,
    },
    proxy: {
      '/api': {
        target: 'http://127.0.0.1:3000',
        changeOrigin: true,
        pathRewrite: { '^/api': '' },
      },
    },
  },
  chainWebpack: config => {
    config.resolve.alias.set('@', resolve('src'))
  },
}
